my $pl = ( 0 < @ARGV && $ARGV[0] =~ /^p$/i ); 
my $c = ( 0 < @ARGV && $ARGV[0] =~ /^c$/i ); 
my $css = ( 0 < @ARGV && $ARGV[0] =~ /^css$/i ); 
my $js = ( 0 < @ARGV && $ARGV[0] =~ /^j$/i ); 
my $tag = ( 0 < @ARGV && $ARGV[0] =~ /^t$/i ); 
my $r = ( 0 < @ARGV && $ARGV[0] =~ /^r$/i ); 
my $dot = ( 0 < @ARGV && $ARGV[0] =~ /^d$/i ); 
my $uws = ( 0 < @ARGV && $ARGV[0] =~ /^u$/i ); 
my $as = ( 0 < @ARGV && $ARGV[0] =~ /^a$/i ); 
BEGIN{ my $post = 0 ; } 
while( <STDIN> ) { 
    $pl && do { 
        s,^(\s*)//,$1#,; 
        s,^/\*,$1=pod,; 
        s,^\*/,$1=cut,; 
        s,^(\s*\{\s*)//,$1#,; 
        s,^(?!\s*(?:my|our)\s)(\s*)(\S+\s*)\([^\)]*\)(\s*\{\s*)//,$1sub $2$3#,; 
        s,^(?!\s*sub\s)(\s*[^\{]*?[^\{\s])\s*;?\s*(\{\s*)//,$1 ; $2#,; 
        s,^(?!\s*sub\s)(\s*[^\{;/]*;\s*)//,$1#,; 
    }; 
    $c && do { 
        ; 
    }; 
    $css && do { 
        m,^[^{;]*;?\s*{\s*//, && ( s"^([^{;]*);?(\s*{\s*)//"$1$2/*", s"(?=$)" */" ); 
        m,^\s*//, && ( s"^(\s*)//"$1/*", s"(?=$)" */" ); 
    }; 
    $js && do { 
        s,^(\s*)(\S+\s*\([^\)]*\)\s*\{\s*)//,$1function $2//,; 
        s,^(?!\s*function\s)(\s*[^\{;]*[^\{;\s])\s*;?\s*(\{\s*)//,$1 ; $2//,; 
        s,([\,\*])\;(?=\s*$),$1,; 
    }; 
    $tag && do { 
        m,^\s*//, && ( s/^\s*/$&<!-- /, s/$/ -->/ ), s,(>\s*);$,$1, ; 
        s,<\-([\w\-]+)>,</$1>,g ; 
    }; 
    $r && do { 
        s,^(\s*\S+\s*)(\([^\)]*\)\s*\{\s*)//,$1 <- function $2#,; 
        s,^(\s*\S+)(\s*)(;?\s*)//,$1 <- NULL$2; $3#,; 
        s,^(\s*)//,$1#,; 
    }; 
    $dot && do { 
        m,^[^{;]*;?\s*{\s*//, && ( s"^([^{;]*);?(\s*{\s*)//"$1$2/*", s"(?=$)" */" ); 
        m,^\s*//, && ( s"^(\s*)//"$1/*", s"(?=$)" */" ); 
    }; 
    $uws && do { 
        m,^[^{;]*;?\s*{\s*//, && s"^([^{;]*);?(\s*){\s*//"$1$2//" ; 
        m,^\s*}\s*$, && s"^(\s*)}(\s*)$"$1//$2" ; 
        m,^\s*ifb\s.*\S +endif;?(?=\s|$), && s"^(\s*)ifb(\s.*\S) +endif;?(?=\s|$)"$1if$2" ; 
        m,^\s*if\s.*?;(?=\s*$), && s"^(\s*if\s.*?);(?=\s*$)"$1" ; 
    }; 
    $as && do { 
        m,^[^{;]*;?\s*{\s*//, && s"^([^{;]*);?\s*{(\s*)//"$1--$2" ; 
        m,^\s*//, && s"^(\s*)//"$1--" ; 
        s,/\*,(*,g ; s,\*/,*),g ; s,\s*;(?=\s*$),, ; s,;;,\x0a,g ; 
        m,^\s*}\s*$, && s"^(\s*)}(\s*)$"$1$2" ; 
    }; 
    print; 
} 

